<header id="topbar" class="affix" style="top:60px;">
    <link rel="stylesheet" type="text/css" href="../../css/withdraws.css">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#op/withdraw/">红包查询</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <!--<span class="text text-muted" id="selectTips">已选中0个</span>-->
        <!--<button class="btn btn-default btn-sm" id="paymentMethods">提现通道选择</button>-->
        <!--<button class="btn btn-default btn-sm" id="updateLimit">提现门槛设置</button>-->
        <!--<button class="btn btn-default btn-sm" id="checkSuccess">一键审核通过</button>-->
        <!--<button class="btn btn-default btn-sm" id="checkFail">一键审核失败</button>-->
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <% if(items.length > 0){ %>
    <div class="panel overflow">
        <table class="table table-striped fs13" id="main-list">
            <thead>
                <tr class="bg-light">
                    <th>用户ID</th>
                    <th class="sortable" data-field="price">红包ID</th>
                    <th data-field="real_price">获取来源</th>
                    <th>红包名称</th>
                    <th>红包种类</th>
                    <th>描述</th>
                    <th class="text-right">红包金额</th>
                    <th>状态</th>
                    <th class="sortable text-center" data-field="created_at">生效时间</th>
                    <th class="sortable text-center" data-field="updated_at">过期时间</th>
                    <th class="sortable text-center">使用时间</th>
                </tr>
            </thead>
            <tbody class="admin-form">
                <% _.each(items, function(item){ %>
                    <tr data-uid="<%= item.uid %>" data-id="<%= item.id %>">
                        <td><a href="#stats/account/?id=<%= item.user_id %>"><%= item.is_virtual ? '*' : '' %><%= item.user_id %></a></td>
                        <td><%= item.template_id %></td>
                        <td><%= window.COUPON_SOURCE(item.source)%></td>
                        <td><%= item.title %></td>
                        <td><%= COUPON_TYPE[item.coupon_type] %></td>
                        <td><%= item.desc %></td>
                        <td class="text-right"><%= item.price %></td>
                        <td><%= COUPON_STATUS[item.status] %></td>
                        <td class="text-center"><%= item.start_ts %></td>
                        <td class="text-center"><%= item.expire_ts %></td>
                        <td class="text-center"><%= item.use_time?item.use_time:'-' %></td>
                    </tr>
                <%
                }) %>
            </tbody>
        </table>
    </div>
    <div>
        <div class="pull-left mr20" id="page-tips"></div>

        <div style="display: inline-block">
            <span>可使用数量：<strong class="text-danger"><%= unuse_count %></strong></span>
            <span>可使用金额：<strong class="text-danger"><%= unuse_price %></strong></span>
            <span>已使用数量：<strong class="text-danger"><%= used_count %></strong></span>
            <span>已使用金额：<strong class="text-danger"><%= used_price %></strong></span>
            <span>已过期数量：<strong class="text-danger"><%= expire_count %></strong></span>
            <span>已过期金额：<strong class="text-danger"><%= expire_price %></strong></span>
        </div>
        <div id="paginator"></div>
    </div>
    <% }else{ %>
    <h4 class="text-muted">请输入用户ID进行搜索</h4>
    <% } %>
</section>


<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano" style="top: 110px;">
    <div class="p20 admin-form">
        <h4 class="mt5 text-muted fw500">过滤条件：</h4>
        <hr class="short">
        <div class="section mb15">
            <label class="field prepend-icon">
                <input title="用户ID" type="text" id="searchUid" class="gui-input" data-field="user_id" placeholder="用户ID" value="<%= searched.user_id %>">
                <label class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>
        <h6 class="fw400">红包类型</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchCouponType" name="searchCouponType" data-field="coupon_type">
                    <option value="-1" <%= searched.coupon_type == -1 ? 'selected' : '' %>>所有</option>
                    <% _.each(COUPON_TYPE, function(v, k){ %>
                    <option value="<%= k %>" <%= searched.coupon_type == k ? 'selected' : '' %>><%= v %></option>
                    <% }) %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <h6 class="fw400">红包状态</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchCouponStatus" name="searchCouponStatus" data-field="status">
                    <option value="-1" <%= searched.coupon_status == -1 ? 'selected' : '' %>>所有</option>
                    <% _.each(COUPON_STATUS, function(v, k){ %>
                    <option value="<%= k %>" <%= searched.coupon_status == k ? 'selected' : '' %>><%= v %></option>
                    <% }) %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <h6 class="fw400">红包来源</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchCouponSource" name="searchCouponSource" data-field="source">
                    <option value="-1" <%= searched.coupon_source == -1 ? 'selected' : '' %>>所有</option>
                    <option value="register" <%= searched.coupon_source == 'register' ? 'selected' : '' %>>注册送活动	</option>
                    <option value="system" <%= searched.coupon_source == 'system' ? 'selected' : '' %>>系统添加	</option>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <h6 class="fw400" id="effectSearchTime" style="cursor: pointer">生效时间</h6>
        <div class="section row" id="searchEffectTime">
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="effect_time.$gte" data-useless="" placeholder=">=" value="<%= searched.effect_time ? searched.effect_time.$gte : '' %>">
            </div>
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="effect_time.$lt" data-useless="" placeholder="<=" value="<%= searched.effect_time ? searched.effect_time.$lt : '' %>">
            </div>
        </div>
        <h6 class="fw400" id="useSearchTime" style="cursor: pointer">使用时间</h6>
        <div class="section row" id="searchUpdatedAt">
        <div class="col-md-6">
        <input type="text" class="gui-input datetime-input" data-field="use_time.$gte" data-useless="" placeholder=">=" value="<%= searched.use_time ? searched.use_time.$gte : '' %>">
        </div>
        <div class="col-md-6">
        <input type="text" class="gui-input datetime-input" data-field="use_time.$lt" data-useless="" placeholder="<=" value="<%= searched.use_time ? searched.use_time.$lt : '' %>">
        </div>
        </div>
        <hr class="short">

        <div class="row">
            <div class="col-md-12">
                <button class="btn btn-primary btn-block form-control" id="search">搜索</button>
            </div>
        </div>

    </div>
</aside>
<!-- End: Right Sidebar -->



